package com.ck.ckcloud.networkmanagement.domain.entity;

import com.ck.ckcloud.networkmanagement.infrastructure.persistence.DO.ResourceDO;
import com.ck.ckcloud.networkmanagement.infrastructure.repository.ResourceRepository;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * 网管资源实体
 *
 * @author Aiden <a href="mailto:adam602260@gmail.com"/>
 * @version NetworkManagement.java v0.1
 * @create 2019-09-18 17:12
 */
@Data
public class Resource implements Serializable {


	private static final long serialVersionUID = -2280777825816949953L;

	private ResourceRepository resourceRepository;

    private String resourcetype;

    private String resourcename;

    private String resourcemodel;

    private String resourceuniqueid;

    private String os;

    private String ip;

    private String mask;

    private String cpu;

    private String mem;

    private String mac;

    private String managetype;

    private String managestatus;

    private Boolean iscritical;

    private String district;

    private String manager;

    private String description;

    private Integer health;

    private Integer availability;

    private String manufacturer;

    private Integer childresourceindex;

    private String capacity;

    private Integer parentresourceid;

    public Resource(){}

	public Resource(ResourceRepository resourceRepository) {
		this.resourceRepository = resourceRepository;
	}

	/**
	 * 根据UniqueId查询一个资源
	 * @param uniqueId
	 * @return
	 */
	public Resource getByUniqueId(String uniqueId){
		ResourceDO resourceDO = resourceRepository.getByUniqueId(uniqueId);
		BeanUtils.copyProperties(resourceDO, this);
		return this;
	}


}
